<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer" />
    <title>加密模型对象</title>
    <style>
        body {
            position: absolute;
            margin: 0;
            width: 100%;
            height: 100%;
        }

        #mapContainer {
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            float: left;
        }
    </style>
</head>

<body>

    <div id="mapContainer" style="position: relative;">
    </div>

</body>
<script src='/GiswayEngine.js'></script>
<script type="text/javascript">
    window.app = new GE.App('mapContainer', {
        position: [120.52950010876321, 30.268289949834518, 1000],
        lookAt: [120.52950010876321, 30.268289949834518, 0],
        cameraScrollSpeed: 15,
        minZoom: 3,
        maxZoom: 18,
        ambientLightIntensity: 5,
        ambientLightType: 'hemiSphere',
        useCarpet: true,
        background: "Fog",
        useDefaultTexture: true, //是否使用瓦片默认纹理
        baseLayer: [
            {
                url: ' https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
                readableUrl: true,
                tileType: 'image',
            },
        ]
    });

    fbx();
    // btn();
    app.openStats();
    var model;
    function fbx() {
        model = new GE.OverLay({
            type: 'fbx',
            url: 'http://localhost:9000/examples/resources/fbx/xqazm.gefile',
            encrypted: true,//此参数设置为true代表模型是加密格式
            position: [120.52950010876321, 30.268289949834518, 50],
            // scale: [100, 100, 100],
            // rotation: [45, 0, 0],
            success: function () {
                setTimeout(btn, 300);
            }
        });
        app.add(model);
    }

    function btn() {
        let button = new GE.Button('模型显隐', function () {
            model.visible = !model.visible;
        });
        app.ui.add(button);
        window.button = button;

        let button2 = new GE.Button('模型右移10米', function () {
            model.position.x += 10;
        });
        app.ui.add(button2);

        let button3 = new GE.Button('获取模型详细信息', function () {
            let info = model.getModelInfo();
            alert(JSON.stringify(info));
            console.log(info);
        });
        app.ui.add(button3);
    }
</script>

</html>